package com.acme.task1;


public class Calculator {
	
	public static void main(String[] args) {

		//analyze number of arguments
		if (args.length != 3) {
			System.out.println("Invalid number of arguments:");
			for (int i = 0; i < args.length; i++) {
				System.out.println(i + " argument: "+ args[i]);
			}
			System.exit(0);
		}
		
		//get arguments
		double operand1 = Double.parseDouble(args[0]);
		double operand2 = Double.parseDouble(args[2]);

		//analyze operation and make calculations
		char symbol= args[1].charAt(0);
		
		//print result at console like:
		switch (symbol) {
		case '+':
			System.out.println(operand1 + operand2);
			break;
		case '-':
			System.out.println(operand1 - operand2);
			break;
		case '/':
			System.out.println(operand1 / operand2);
			break;
		case '*':
			System.out.println(operand1 * operand2);
			break;
		default:
			System.out.println("Invalid symbol");

		} 
	}
}


